//
//  EmptyTipView.swift
//  OnceNectar
//
//  Created by 法正磊 on 2018/3/5.
//  Copyright © 2018年 com.inwhoop. All rights reserved.
//
//  没有库存提示视图
import UIKit

class EmptyTipView: UIView {
    private let selfHeight: CGFloat = 16
    private var yPoison: CGFloat = 0
    init(YPoison: CGFloat) {
        super.init(frame: .zero)
        yPoison = YPoison
        setUI()
    }
    
    override func awakeFromNib() {
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    
    /// xib SB 再调用这个
    ///
    /// - Parameter YPoison: Y坐标
    func show(YPoison: CGFloat) {
        yPoison = YPoison
        setUI()
    }
    
    func setUI() {
        self.backgroundColor = UIColor(hex: 0xB94562, alpha: 0.7)
        self.frame = CGRect(x: 0, y: yPoison - selfHeight, width: ScreenWidth, height: selfHeight)
        let emptyLabel = UILabel()
        emptyLabel.textColor = UIColor.white
        emptyLabel.text = "库存不足!"
        emptyLabel.font = UIFont.systemFont(ofSize: 12)
        self.addSubview(emptyLabel)
        emptyLabel.snp.makeConstraints { (make) in
            make.center.equalTo(self.snp.center)
        }
    }
    
}
